HybridMail Technical - XML Attachments
Updated: 09-12-2022 16:10

XML Attachments

HybridMail supports two types of attachment: PDF and XML.

A PDF Attachment is a file that will be appended to the Letter file as it is being released to the printer.

An XML Attachment is a file containing a script that will be interpreted and executed by the system.

PDF Attachments

  • PDF Attachments can be attached to a Template or to a Letter
  • PDF Template Attachments will be appended to all Letters generated using that Template when the Letters are finally printed
  • PDF Letter Attachments can be either selected from the list of available Attachments, or uploaded as a 'one-off' PDF Custom Attachment
  • PDF Attachments should ideally have the same paper size and orientation as the Letter to which they will be appended. If not, they will be converted to the correct size, which can sometimes cause subtle changes in layout
  • PDF Attachments will be appended in the order: Custom Attachment – Letter Attachments – Template Attachments

XML Attachments

  • XML Attachments can only be attached to a Template i.e. not to a Letter.
  • XML Attachments will be executed in the order they are attached to the Template
  • XML Attachments can be processed at any (or all) of five phases during processing
    • OnPreSubmit – after the letter is received but before the letter is written to the database
    • OnSubmit - after the letter is written to the database
    • OnRelease – when the Output Queue is released.
    • OnRelay – before the Letter is Relayed to another Hybridmail server
    • OnEmail – before the Letter is Emailed to the recipient

XML Attachment Schema

<mkzAttachments>
	<mkzAttachment type="attachment-type">
		<onPreSubmit|onSubmit|onRelease|OnRelay|OnEmail>
			<!-- Attachment specific elements go here -->
		</onPreSubmit|onSubmit|onRelease|OnRelay|OnEmail>
	</mkzAttachment>
	<mkzAttachment type="different-attachment-type">
		<onPreSubmit|onSubmit|onRelease|OnRelay|OnEmail>
			<!-- Attachment specific elements go here -->
		</onPreSubmit|onSubmit|onRelease|OnRelay|OnEmail>
	</mkzAttachment>
		... etc
</mkzAttachments>

The XML supports the following elements. There can be multiple instances of these

<mkzAttachment  type="appendPdf|carbonCopy|changeOptions|combiner|customData|dataQuery|email|eMessage|stamper|external">

This element defines the attachment and its type. There must be at least one of these elements.

<onPreSubmit>  

This element defines the processing that will take place after the letter file is received by HybridMail, but before it is written to the database. When this phase runs, the letter object has been created, the letter file loaded and a subset of the letter properties are valid. No database-related properties are valid during this phase.

<onSubmit>  

This element defines the processing that will take place after the letter file is written to the database. When this phase runs, the letter object is fully populated and the letter file loaded. All aspects of letter processing are available during this phase, which is typically where the bulk of processing takes place

<onRelease>  

This element defines the processing that will take when the output queue is released. When this phase runs, the letters have been sorted into trays and have their attachments as separate PDF files. No access to the letter's PDF file is possible during this phase, i.e. text cannot be scanned from the letter.

<onRelay>  

This element defines the processing that will take when a finished letter is relayed to another HybridMail server. When this phase runs, the letter and all its attachments have been merged into a single PDF file.

<onEmail>  

This element defines the processing that will take when a finished letter is emailed to a recipient. When this phase runs, the letter and all its attachments have been merged into a single PDF file.

The type attribute selects which attachment script will be run.

<mkzAttachment type="appendPdf">

This attachment appends files to the letter file, usually based on information scanned from the letter. It can also merge files with the letter file, and add or delete pages. In addition, XML files (which affect the letter processing) can be added or removed.

<mkzAttachment type="carbonCopy">

This attachment scans a letter for any CC: addresses and generates the required CC letters automatically, optionally with a cover sheet.

<mkzAttachment type="changeOptions">

This attachment changes the properties of the letter, e.g. firstclass, colour, etc. based on information scanned from the letter. The letter status and output queue can also be modified.

<mkzAttachment type="combiner">

This attachment uses information scanned from each letter, typically the recipient name and address to determine if multiple letters can be combined into the same envelope.

<mkzAttachment type="customData">

This attachment collects information from the letter, typically reference numbers etc. and stores it in the database with the letter. This information can be included in reports.

<mkzAttachment type="dataQuery">

This attachment can query database records. This is normally used to obtain information which can then be used during the processing of other attachments.

<mkzAttachment type="email">

This attachment type collects information from the letter about the intended recipient’s email address, mobile number etc. and stores it in the database with the letter. This information is then used by the Email output to generate the email.

<mkzAttachment type="eMessage">

This attachment type collects information from the letter about the intended recipient’s email address, mobile number etc. and stores it in the database with the letter. This information is then used by the eDelivery output to generate the sequence of email and SMS messages to securely send the letter electronically.

<mkzAttachment type="stamper">

This attachment stamps text, blanking rectangles, images and barcodes onto the letter PDF file.